<?php

declare(strict_types=1);

namespace App\Model\Log;

use App\Model\UserProfile;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;

class RongcloudResults extends Model
{
    const RONG_TEXT_TYPE = 'RC:TxtMsg';
    const RONG_IMG_TYPE = 'JT:USER_IMAGE';
    const RONG_SOUND_TYPE = 'RC:HQVCMsg';
    const RONG_VIDEO_TYPE = 'JT:USER_VIDEO';

    const MSG_TYPE = [
        self::RONG_TEXT_TYPE => '文字',
        self::RONG_IMG_TYPE => '图片',
        self::RONG_SOUND_TYPE => '声音',
        self::RONG_VIDEO_TYPE => '视频',
    ];
    const RISK_LEVEL = [
        'PASS' =>'通过',
        'REVIEW' =>'可疑',
        'REJECT' => '违规'
    ] ;

    protected $table = 'rongcloud_results';
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function eventUser()
    {
        return $this->belongsTo(UserProfile::class, 'from_user_id', 'user_id');
    }

    public function eventToUser()
    {
        return $this->belongsTo(UserProfile::class, 'to_user_id', 'user_id');
    }
}
